package com.usermanage.ServiceImpl;

import com.usermanage.Mapping.CompanyMapping;
import com.usermanage.Mapping.OrderMapping;
import com.usermanage.Service.CompanyService;
import com.usermanage.Service.OrderService;
import com.usermanage.beanParam.CompanyBean;
import com.usermanage.beanParam.OrderBean;
import com.usermanage.beanParam.UserBean;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;

/**
 * Created by 過客 on 2018/3/9
 */
@Service("orderService")
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderMapping orderMapping;


    @Override
    public List<OrderBean> findAllList(String key, String page, String size) {
        return null;
    }

    @Override
    public int getAllUserListCount(String key) {
        return 0;
    }

    @Override
    public Boolean isExisit(OrderBean bean) {
        Example<OrderBean> example = Example.of(bean);
        return orderMapping.exists(example);
    }

    @Override
    public OrderBean save(OrderBean bean) {
        return orderMapping.save(bean);
    }

    @Override
    public Optional<OrderBean> findById(int id) {
        return orderMapping.findById(id);
    }

    @Override
    public List<OrderBean> findAll(OrderBean bean) {
        Example<OrderBean> example = Example.of(bean);
        return orderMapping.findAll(example);
    }

    @Override
    public void delete(OrderBean bean) {
        orderMapping.delete(bean);
    }
}
